package Store
{
	import Config.GameConfig;
	
	import flash.net.SharedObject;
	
	public class GameStore
	{
		private static var sharedData:SharedObject;
		
		public static function store(key:String, value:Object):void
		{
			getSharedObject();
			sharedData.data[key] = value;
			sharedData.flush();
		}
		public static function retrieve(key:String):Object
		{
			getSharedObject();
			var value:Object = sharedData.data[key];
			return value;
		}
		public static function deleteValue(key:String):void
		{
			getSharedObject();
			delete sharedData.data[key];
			sharedData.flush();
		}
		private static function getSharedObject():void
		{
			if (!sharedData)
			{
				sharedData = SharedObject.getLocal(GameConfig.shortName, "/");
			}
		}
	}
}